package com.cskaoyan.service.impl;

import com.cskaoyan.bean.BaseParam;
import com.cskaoyan.bean.MarketKeyword;
import com.cskaoyan.mapper.MarketKeywordMapper;
import com.cskaoyan.service.MarketKeywordService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (MarketKeyword)表服务实现类
 *
 * @author makejava
 * @since 2021-10-19 09:19:00
 */
@Service("marketKeywordService")
public class MarketKeywordServiceImpl implements MarketKeywordService {
    @Resource
    private MarketKeywordMapper marketKeywordMapper;
    /**
     * 分页查询
     *
     *
     * @return 查询结果
     */
    @Override
    public List<MarketKeyword> queryByPage(String keyword, String url, BaseParam param) {
        List<MarketKeyword> marketKeywords = marketKeywordMapper.queryAllByLimit(keyword,url,param.getOrder(), param.getSort());
        return marketKeywords;
    }

    /**
     * 新增数据
     *
     * @param marketKeyword 实例对象
     * @return 实例对象
     */
    @Override
    public MarketKeyword insert(MarketKeyword marketKeyword) {
        marketKeywordMapper.insert(marketKeyword);
        return marketKeyword;
    }

    /**
     * 修改数据
     *
     * @param marketKeyword 实例对象
     * @return 实例对象
     */
    @Override
    public MarketKeyword update(MarketKeyword marketKeyword) {
       marketKeywordMapper.update(marketKeyword);
        return marketKeyword;
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return marketKeywordMapper.deleteById(id) > 0;
    }
}
